import React from "react";


export default class Add extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            value : ""
        };
        this.onChange = this.onChange.bind(this);
    }
    onChange(e){
        this.setState({
            value : e.target.value
        })
    }
    render(){
        return(
            <div className="add">
                <form>
                    <input type="text" value={this.state.value} onChange={this.onChange} />
                    <span className="btn" onClick={this.props.add.bind(this,this.state.value)}>添加</span>
                </form>
            </div>
        )
    }

}